# encoding=UTF-8
import json

from constant import datais

def out_farmat_users(rows):

    for row in rows:
        row['id_user']=row['id']
        row.pop('cpwd')
        row.pop('id')
        row['img']="%s%s"%(datais.url_img,row['img'])
        for item in row:
            if row[item]==None:
                row[item]=''
    return  rows

def out_farmat_actor(rows):
    for row in rows:
        row['id_actor']=row['id']
        row.pop('id')
        row['img_post']="%s%s"%(datais.url_img,row['img_post'])
        for item in row:
            if row[item]==None:
                row[item]=''
    return  rows


def out_farmat_video(rows,ctype=0):
    for row in rows:
        row['id_video']=row['id']
        row.pop('id')
        row['live_picurl']="%s%s"%(datais.url_img,row['live_picurl'])
        if ctype==1:
            row['actor']=get_user_actor(row['id_actor'])
        for item in row:
            if row[item]==None:
                row[item]=''
    return  rows



def out_farmat_zone_node(rows):
    for row in rows:
        row['id_zone_node']=row['id']
        row.pop('id')
        row['img']="%s%s"%(datais.url_img,row['img'])
        for item in row:
            if row[item]==None:
                row[item]=''
    return  rows


#通用,不需id
def out_farmat_common_noid(rows):
    for row in rows:
        row.pop('id')
        for item in row:
            if row[item]==None:
                row[item]=''
    return  rows
